/*****************************************************************************/
/*                                                                           */
/*    Domino Operation System Kernel Module                                  */
/*                                                                           */
/*    Copyright (C) 2008 Laszlo Arvai                                        */
/*                                                                           */
/*    ------------------------------------------------------------------     */
/*    krnlUART - UART Kernel Driver (line oriented, text mode)               */
/*****************************************************************************/

#ifndef __krnlUART_h
#define __krnlUART_h

///////////////////////////////////////////////////////////////////////////////
// Includes
#include <krnlTypes.h>
#include <krnlString.h>

///////////////////////////////////////////////////////////////////////////////
// Function prototypes
void krnlUARTInit(void);

// transmitter functions
void krnlUARTTransmitInterrupt(void);
void krnlUARTSendCharacter( dosChar in_char );
dosBool krnlUARTSendString( dosString in_string );
void krnlUARTSendConstString( dosConstString in_string );
dosBool krnlUARTIsTransmitterEmpty(void);

// receiver functions
void krnlUARTReceiveInterrupt( dosChar in_char );
void krnlUARTRestartReceiver(void);
dosByte krnlUARTGetReceivedLineLength(void);
dosChar krnlUARTGetCharacter(dosByte in_index);
dosBool krnlUARTIsLineReceived(void);

// receiver parser functions
void krnlUARTSkipWhitespaces(dosByte* in_index);
dosBool krnlUARTCheckForConstStringNoCase( dosByte* inout_index, dosConstString in_string );
void krnlUARTCharToInt16( dosByte* in_index, dosBool* in_success, dosInt16* out_number );

extern dosChar g_receive_buffer[];

#endif
